SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS `t_sys_oss_record`;

-- @miaoma-begin
-- @business_name: sys_oss_record
-- @config: common, java, springboot
-- @enum: status 1=正常 0=已删除
-- @enum: storage_type local=本地存储 aliyun=阿里云OSS

-- @package: cn.com.anypay.manager.miaoma

CREATE TABLE `t_sys_oss_record` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
  `file_name` varchar(255) NOT NULL COMMENT '文件名',
  `file_path` varchar(500) NOT NULL COMMENT '文件路径',
  `file_url` varchar(500) NOT NULL COMMENT '文件访问URL',
  `file_size` bigint NOT NULL COMMENT '文件大小(字节)',
  `file_type` varchar(100) NOT NULL COMMENT '文件类型',
  `storage_type` varchar(50) NOT NULL COMMENT '存储类型(local/aliyun)',
  `status` tinyint NOT NULL DEFAULT '1' COMMENT '状态：1-正常，0-已删除',
  `created_time` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
  `updated_time` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
  PRIMARY KEY (`id`),
  KEY `idx_file_name` (`file_name`),
  KEY `idx_storage_type` (`storage_type`),
  KEY `idx_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='OSS文件记录表';

-- @miaoma-end

-- ----------------------------
-- Records of t_sys_oss_record
-- ----------------------------
BEGIN;
INSERT INTO `t_sys_oss_record` (`id`, `file_name`, `file_path`, `file_url`, `file_size`, `file_type`, `storage_type`, `status`, `created_time`) VALUES 
(1, 'avatar_001.jpg', '/uploads/avatars/2025/06/avatar_001.jpg', 'https://cdn.anypay.com/uploads/avatars/2025/06/avatar_001.jpg', 102400, 'image/jpeg', 'aliyun', 1, '2025-06-06 10:30:15.123'),
(2, 'document_001.pdf', '/uploads/documents/2025/06/document_001.pdf', 'https://cdn.anypay.com/uploads/documents/2025/06/document_001.pdf', 2048000, 'application/pdf', 'aliyun', 1, '2025-06-06 11:15:30.456'),
(3, 'logo.png', '/uploads/images/2025/06/logo.png', 'http://localhost:8080/uploads/images/2025/06/logo.png', 51200, 'image/png', 'local', 1, '2025-06-06 12:00:45.789'),
(4, 'backup_data.zip', '/uploads/backups/2025/06/backup_data.zip', 'https://cdn.anypay.com/uploads/backups/2025/06/backup_data.zip', 10485760, 'application/zip', 'aliyun', 0, '2025-06-06 13:20:10.012'),
(5, 'report_202506.xlsx', '/uploads/reports/2025/06/report_202506.xlsx', 'http://localhost:8080/uploads/reports/2025/06/report_202506.xlsx', 512000, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'local', 1, '2025-06-06 14:45:25.345');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;